-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FE: Broker not shown in a list if disk usage is unknown for it #3981
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello there corazoncoding! 👋
Thank you and congrats 🎉 for opening your first PR on this project! ✨ 💖
We will try to review it soon!
|
||
import SkewHeader from './SkewHeader/SkewHeader'; | ||
import * as S from './BrokersList.styled'; | ||
|
||
const NA = 'N/A'; | ||
const NA = 'N/A' as unknown; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we are going to do type casting can't we do it all of it here ? otherwise it the half of it are someplace.
it('renders list of all brokers', async () => { | ||
renderComponent(); | ||
expect(screen.getByRole('table')).toBeInTheDocument(); | ||
expect(screen.getAllByRole('row').length).toEqual(3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make the .toEqual(3);
the number inside to be dynamic based on the mock data ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, done
Kudos, SonarCloud Quality Gate passed! |
|
||
import SkewHeader from './SkewHeader/SkewHeader'; | ||
import * as S from './BrokersList.styled'; | ||
|
||
const NA = 'N/A'; | ||
const NA = 'N/A' as unknown as number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that we cast string to number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because in this component we use N/A as a failsafe for a number types. The other way would be to change autogenerated types to also accept string for size and count props
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can actually write sanitizer function and link it to useBrokers
that way the FE will have control over the type, do it once after we fetch inside the hook useBrokers
instead of doing it with useMemo
on every render.
What changes did you make? (Give an overview)
Fixed #3615
Is there anything you'd like reviewers to focus on?
How Has This Been Tested? (put an "x" (case-sensitive!) next to an item)
Checklist (put an "x" (case-sensitive!) next to all the items, otherwise the build will fail)
Check out Contributing and Code of Conduct
A picture of a cute animal (not mandatory but encouraged)